package com.zyf.chapter02.behavior.chain.word;

/**
 * 场景：UGC（User Generated Content, 用户生成内容）的应用（比如论坛）来说，用户生成的内容可能会包含一些
 * 敏感词。利用职责链来过滤这些敏感词。
 * @author yifeng
 */
public class Application {
    public static void main(String[] args) {
        SensitiveWordFilterChain filterChain = new SensitiveWordFilterChain();
        filterChain.addFilter(new SexyWordFilter());
        filterChain.addFilter(new AdsWordFilter());
        filterChain.addFilter(new PoliticalWordFilter());

        boolean legal = filterChain.filter("内容");
        if (legal) {
            // 发表
        }
        // 不发表
    }
}
